import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter/material.dart';
import 'package:my_app/app/core/theme/app_colors.dart';

class CustomDefaultPickerWidget extends Picker {
  final String? titleText;

  CustomDefaultPickerWidget(
      {required PickerAdapter adapter,
      List<int>? selecteds,
      this.titleText,
      String? confirmText,
      String? cancelText,
      double? height,
      PickerConfirmCallback? onConfirm})
      : super(
          adapter: adapter,
          selecteds: selecteds,
          height: height ?? 200.0,
          confirmText: confirmText ?? "确定",
          onConfirm: onConfirm,
          cancelText: cancelText ?? "取消",
          itemExtent: 40.0,
        );

  @override
  TextStyle? get cancelTextStyle => TextStyle(color: cancelTextColor);

  @override
  Widget? get title =>
      Text(titleText ?? '', style: TextStyle(color: textContentColor));

  @override
  TextStyle? get selectedTextStyle => TextStyle(fontWeight: FontWeight.w500);

  @override
  Decoration? get headerDecoration => BoxDecoration(
        border: Border(
          top: BorderSide(color: dividerColor, width: 0.5),
        ),
        color: super.headerColor ?? Colors.white,
      );

  @override
  Widget get selectionOverlay => Container(
        decoration: BoxDecoration(
          border: Border(
            top: BorderSide(color: Colors.black12, width: 0.6),
            bottom: BorderSide(color: Colors.black12, width: 0.6),
          ),
        ),
      );
}
